package com.whale.Task;

import com.whale.entity.Orders;
import com.whale.entity.VenceOccupy;
import com.whale.mapper.OrderMapper;
import com.whale.mapper.VenueOccupyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;



import java.time.LocalDateTime;
import java.util.List;

@Component
@Slf4j
public class VenceOccupyTask {


    @Autowired
    private VenueOccupyMapper venueOccupyMapper;

    /**
     *处理超时场地占用的方法
     *
     */

    @Scheduled(cron = "0 * * * * ?")
    public void processTimeoutOrder() {

        log.info("定时处理超时场地占用:{}", LocalDateTime.now());
        LocalDateTime time = LocalDateTime.now().plusMinutes(-1);
         venueOccupyMapper.deleteByEndTimeLT(time);

        }

    }


